/*
 * User: ophir
 * Date: Sep 10, 2008
 * Time: 9:08:19 AM
 */
package org.conann.metadata.injection;

import org.conann.metadata.BeanMD;

import java.lang.reflect.AnnotatedElement;

public abstract class InjectionRequirement<T extends AnnotatedElement> {

    private final T element;
    private final Class<?> requiredType;
    private final BeanMD beanMD;

    @SuppressWarnings({"AbstractMethodCallInConstructor", "OverridableMethodCallDuringObjectConstruction"})
    protected InjectionRequirement(T element) {
        this.element = element;
        beanMD = new BeanMD(element);
        requiredType = resolveRequiredType();
    }

    public T getElement() {
        return element;
    }

    public Class<?> getRequiredType() {
        return requiredType;
    }

    public BeanMD getComponentMD() {
        return beanMD;
    }

    protected abstract Class<?> resolveRequiredType();
}